# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2024/9/28
desc: 
sample: 
"""
class Student:

    def __init__(self, name, age,stu_id):
       self.name = name
       self.age = age
       self.id=stu_id

    def info(self):
        message = "我叫{}，今年{}岁".format(self.name, self.age)
        #message = f"我叫{self.name}，今年{self.age}岁"
        print(message)

s1 = Student("mtx", 19,1001)
s2 = Student("亚军", 18,1002)
s3 = Student("光照", 19,1003)
s4 = Student("光照", 20,1003)

class Clz:

    def __init__(self,name) -> None:
         self.name = name
         self.__stu_list=[]
         self.__stu_set=set()

    def add_stu(self,stu:Student):
        for set_stu in self.__stu_set:
            if f'{stu.name}_{stu.id}'==set_stu :
                print(f"{set_stu} 已经存在了")
                return
        self.__stu_set.add(f'{stu.name}_{stu.id}')
        self.__stu_list.append(stu)

    def info(self):
        for stu in self.__stu_list:
            print(f'{stu.id} {stu.name}')

clz1 = Clz('一班')
clz1.add_stu(s1)
clz1.add_stu(s2)
clz1.add_stu(s3)
clz1.add_stu(s4)
print('学生信息')
clz1.info()
